package de.uni.muenster.idw2.data;

import java.util.LinkedList;

import android.os.Parcel;
import android.os.Parcelable;

public class Floor implements Parcelable{

	
	private double id;
	private int number;
	
	private LinkedList<Room> rooms = new LinkedList<Room>();
	
	public Floor(Parcel source){
		id = source.readDouble();
		number = source.readInt();
		
		source.readTypedList(rooms, Room.CREATOR);
	}

	public Floor(double id, int number) {
		super();
		this.id = id;
		this.number = number;
	}

	public double getId() {
		return id;
	}

	public void setId(double id) {
		this.id = id;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public LinkedList<Room> getRooms() {
		return rooms;
	}

	public void setRooms(LinkedList<Room> rooms) {
		this.rooms = rooms;
	}
	
	public void addRoom(Room room){
		rooms.add(room);
	}

	@Override
	public int describeContents() {
		return 0;
	}
	

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeDouble(id);
		dest.writeInt(number);
		dest.writeTypedList(rooms);
	}
	
	
	public static final Parcelable.Creator CREATOR = new Creator() {

		@Override
		public Floor createFromParcel(Parcel source) {
			return new Floor(source);
		}

		@Override
		public Floor[] newArray(int size) {
			return new Floor[size];
		}
	};
	
}
